/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.coopeud.vista.eventos;

/**
 *
 * @author Alejo
 */
public class VentanaAdministrarEventos extends javax.swing.JFrame {

    private VentanaEventos ventana;
    private VentanaCancelarEvento cancel;
    private VentanaAutorizarSobreCupo autoriza;
    
    public VentanaAdministrarEventos() {
        super("Administrar Eventos");
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnCancelarEvt = new javax.swing.JButton();
        btnAutorizarSobrecupo = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        btnCancelarEvt.setText("Cancelar Evento");
        btnCancelarEvt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarEvtActionPerformed(evt);
            }
        });

        btnAutorizarSobrecupo.setText("Autorizar Sobrecupo");
        btnAutorizarSobrecupo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAutorizarSobrecupoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCancelarEvt)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAutorizarSobrecupo)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCancelarEvt)
                    .addComponent(btnAutorizarSobrecupo))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCancelarEvtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarEvtActionPerformed
        cerrar();
        getCancel().setVisible(true);
    }//GEN-LAST:event_btnCancelarEvtActionPerformed

    private void btnAutorizarSobrecupoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAutorizarSobrecupoActionPerformed
        cerrar();
        getAutoriza().setVisible(true);
    }//GEN-LAST:event_btnAutorizarSobrecupoActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        cerrar();
        getVentana().setVisible(true);
    }//GEN-LAST:event_formWindowClosing

    public void cerrar(){
        dispose();
    }
    
    public VentanaEventos getVentana(){
        if (ventana==null){
            ventana=new VentanaEventos();
        }
        return ventana;
    }
    
    private VentanaCancelarEvento getCancel(){
        if (cancel==null){
            cancel=new VentanaCancelarEvento();
        }
        return cancel;
    }
    
    private VentanaAutorizarSobreCupo getAutoriza(){
        if (autoriza==null){
            autoriza=new VentanaAutorizarSobreCupo();
        }
        return autoriza;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAutorizarSobrecupo;
    private javax.swing.JButton btnCancelarEvt;
    // End of variables declaration//GEN-END:variables
}
